package com.bamboo.framework.common.qiniu.kodo.enums;

import com.qiniu.common.Zone;

/**
 * @Author: GuoQing
 * @Date: 2019/1/29 11:27
 * @description 千牛云区域类型
 */
public enum KodoRegionalType {
  beimei("北美", Zone.zoneNa0()),
  dongnanya("东南亚", Zone.zoneAs0()),
  huabei("华北", Zone.zone1()),
  huadong("华东", Zone.zone0()),
  huanan("华南", Zone.zone2());

  private String name;
  private Zone zone;

  KodoRegionalType(String name, Zone zone) {
    this.name = name;
    this.zone = zone;
  }

  public Zone getZone() {
    return this.zone;
  }

  public String getName() { return this.name;}

  public static Zone getZoneByName(String name){
    KodoRegionalType[] businessModeEnums = values();
    for (KodoRegionalType kodoRegionalType : businessModeEnums) {
      if (kodoRegionalType.getName().equals(name)) {
        return kodoRegionalType.getZone();

      }
    }
    return null;
  }

}
